package com.edu.imau.FixedParking;

import com.edu.imau.ParkingDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/FixedUpdate")
public class FixedUpdateServlet extends HttpServlet {
    private ParkingDao dao =new ParkingDao();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1：接收请求 处理参数
        String fixed_id = request.getParameter("fixed_id");
        //2:调用model
        System.out.println(fixed_id);
        if(fixed_id != null){
            Fixed fixed = dao.getFixedById(Integer.parseInt(fixed_id));
            //3:展示view
            request.setAttribute("fixed",fixed);
            request.getRequestDispatcher("Fixed.jsp").forward(request,response);
        }
    }
}
